﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace NutriLeaf.Phone.Pages
{
    public partial class Tips : PhoneApplicationPage
    {
        public Tips()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //code

            TipService.TipServiceClient client = new TipService.TipServiceClient();

            TipService.Tip tip = new TipService.Tip();
            tip.TipText = " this is a sample tip";
            client.InsertTipCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(client_InsertTipCompleted);
            client.InsertTipAsync(tip);


        }

        void client_InsertTipCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            //completed

            if (e.Error == null)
            {
                MessageBox.Show("Tip Inserted");
            }
            else
            {
                MessageBox.Show(e.Error.Message);
            }

        }
    }
}